<template>
	<view class="content-view">
		<view class="title">{{detail.title}}</view>
		<view class="content">
			<rich-text space="nbsp" :nodes="detail.content" />
		</view>
	</view>
</template>

<script>
	import { getByRiskType } from '@/api/login'
	export default {
		data() {
			return {
				detail: {}
			}
		},
		methods: {
			getContent() {
				getByRiskType({riskType: '2'}).then(res => {
					this.detail = res.data
					this.detail.content = this.detail.content.replace(/\<img/gi, '<img style="max-width:100%;height:auto" ') //替换
				})
			}
		},
		onLoad() {
			this.getContent()
		}
	}
</script>

<style lang="scss">
	.content-view {
		background-color: #fff;
		padding: 24rpx;
		font-size: 28rpx;
		
		.title {
			font-size: 38rpx;
			font-weight: bold;
			color: #1296DB;
			padding-bottom: 20rpx;
		}
		.date {
			font-size: 22rpx;
			color: #888;
			margin-bottom:  30rpx;
		}
		.content {
			padding-top: 20rpx;
			border-top: 1px solid #D8D8D8;
			rich-text {
				line-height: 1.5;
				text-align: justify;
			}
			.ql-size-small {
				font-size: 10px;
			}
			.ql-size-large {
				font-size: 18px;
			}
			.ql-size-huge {
				font-size: 32px;
			}
		}
	}
</style>